﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/common/taglibs.jsp"%>
<%@include file="/common/javascript.jsp"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>teacherInfo</title>
<style type="text/css">
    td {border-color:#ccc}
  	table {color:#08478A; font-size:14px; border-color:#ccc;}
</style> 
<script type="text/javascript">
	var dialog;
	var mainform;
	$(function() {
		
		mainform = $("#mainform");
		mainform.ligerForm();
    
	    $.metadata.setType("attr", "validate");
		LG.validate(mainform);
		$.metadata.setType("attr", "validate");
        LG.validate(mainform);
        
        $.validator.addMethod('sexChecker', function(value) {
        	if (value != -1)
    			return true;
    		else  
    			return false;
            }, '请选择性别'); 

		$(".l-toolbar-item").hover(function() {
			$(this).addClass("l-panel-btn-over");
		}, function() {
			$(this).removeClass("l-panel-btn-over");
		});

		$(".l-toolbar-item").click(function() {
			toolbarBtnItemClick($(this));
		});

		// 给性别赋值
		var tSex = "${command.terSex}";
		if (tSex == '0') {
			$("#terSex").val(0);
		} else {
			$("#terSex").val(1);
		}

	});

	function toolbarBtnItemClick(item) {
		switch (item.attr("toolbarid")) {
		case "modifyInfo":
			LG.submitForm(mainform, function(result) {
				if (typeof (result) == "string") {
					result = eval("(" + result + ")");
				}
				if (!result.success) {
					LG.showError('错误:' + data.message);
				} else {
					LG.showSuccess('保存成功', function() {
						LG.callParent("clsList");
					});
				}
			});
			break;
		case "modifyPwd":
			dialog = $.ligerDialog
					.open({
						url : '${ctx}/qso/teacher/changepwd?terUserId=${command.terUserId}',
						height : 250,
						width : 600,
						showMax : true,
						showToggle : true,
						showMin : true,
						isResize : true,
						modal : true,
						title : "修改密码"
					});
			break;
		}
	}
</script>
</head>
<body style="padding: 0px; overflow: hidden;">
	<div style=" width:100%" id="mainsearch">
    <div class="searchbox" style="padding:10px 10px 10px 10px;">
	<form name="mainform" method="post" id="mainform" action="${ctx }/qso/teacher/save">
		<input type="hidden" name="viewType" value="modify" />
		<input name="terUserId" type="hidden" id="terUserId" value="${command.terUserId}" ltype="text" />
		<input name="dateExpire" type="hidden" id="dateExpire" value="${command.dateExpire}" ltype="text" />
		<input name="remark" type="hidden" id="remark" value="${command.remark}" ltype="text" />
		<table border="1" class="l-table-edit" style="width: 50%; margin-top: 10px; margin-left: 15px;">
			<tr>
				<td align="right" class="l-table-edit-td" style="width: 15%; border-right:none;">老师编号:</td>
				<td align="left" class="l-table-edit-td" style="width: 35%; border-left:none;">${command.terId}
					<input name="terId" type="hidden" id="terId"
					value="${command.terId}" ltype="text" />
				</td>
				<td align="right" class="l-table-edit-td" style="width: 15%; border-right:none;">老师姓名:</td>
				<td align="left" class="l-table-edit-td" style="width: 35%; border-left:none;">
					<input name="terName" type="text" id="terName" maxlength="50"  value="${command.terName}" ltype="text" validate="{required:true, notnull:true}" nullText="不能为空!"/>
				</td>
			</tr>
			<tr>
				<td align="right" class="l-table-edit-td" style="border-right:none;">老师性别:</td>
				<td align="left" class="l-table-edit-td" style="border-left:none;">
				<select id="terSex" name="terSex" validate="{required:true, sexChecker:true}">
						<option value="-1">请选择</option>
						<option value="0">男</option>
						<option value="1">女</option>
				</select></td>
				<td align="right" class="l-table-edit-td" style="border-right:none;">老师电话:</td>
				<td align="left" class="l-table-edit-td" style="border-left:none;">
					<input name="terTel" type="text" id="terTel" maxlength="15"  value="${command.terTel}" ltype="text" validate="{required:true, digits:true, notnull:true}" nullText="不能为空"/>
				</td>
			</tr>
			<tr>
				<td align="right" class="l-table-edit-td" valign="top" style="border-right:none;">老师邮箱:</td>
				<td align="left" class="l-table-edit-td" style="border-left:none;" >
					<input name="terMail" type="text" id="terMail" maxlength="60" value="${command.terMail}" ltype="text" validate="{required:true, email:true, notnull:true}" nullText="不能为空"/>
				</td>
				<td align="right" class="l-table-edit-td" style="border-right:none;">虚机IP:</td>
				<td align="left" class="l-table-edit-td" style="border-left:none;">
					${vmuser.vm.ip}
				</td>
			</tr>
			<tr>
			<tr>
				<td align="right" class="l-table-edit-td" valign="top" style="border-right:none;">备注:</td>
				<td align="left" class="l-table-edit-td" style="border-left:none;" colspan="3">
					${command.remark}
				</td>
			</tr>
			<tr>
				<td colspan="3" style="border-right:none;"></td>
				<td align="right" style="border-left:none;">
					<div class="l-toolbar-item l-panel-btn l-toolbar-item-hasicon"
						toolbarid="modifyInfo">
						<span>修改信息</span>
						<div class="l-panel-btn-l"></div>
						<div class="l-panel-btn-r"></div>
						<img src="${ctx}/static/icons/silkicons/application_edit.png">
					</div>
					<div class="l-toolbar-item l-panel-btn l-toolbar-item-hasicon"
						toolbarid="modifyPwd">
						<span>修改密码</span>
						<div class="l-panel-btn-l"></div>
						<div class="l-panel-btn-r"></div>
						<img src="${ctx}/static/icons/silkicons/application_edit.png">
					</div>
				</td>
			</tr>
		</table>
	</form>

</div>
</div>

</body>
</html>
